package com.cby.jetpack.sample.binding

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import com.cby.jetpack.sample.R
import com.cby.jetpack.sample.binding.data.User3
import com.cby.jetpack.sample.databinding.ActivityDataBindTest3Binding
import com.cby.jetpack.sample.ext.dataBinding

/**
 * @description: TestDataBindingActivity
 *
 * @author ChenBaoyang
 * @date 8/9/21 14:47
 */
class TestDataBinding3Activity : AppCompatActivity() {

    private val binding: ActivityDataBindTest3Binding by dataBinding(R.layout.activity_data_bind_test3)

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        val user = User3("jason","123123","boy")
        binding.user = user

        binding.btnReset.setOnClickListener {
            user.setUserGender("girl-")
            user.setUserName("kevin-")
            user.setUserId("444448888-")
        }
    }
}